// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    string input;
    map<char, int> all_char2int_map;
    map<char, int> used_char2int_map;
    cin >> input;

    // parse the input
    int idx = 0;
    map<char, int>* tmp = &all_char2int_map;
    while(idx < input.length()) {
        // if (input[idx] > 0x41 )
        if (input[idx] == ':') {
            int int_begin = ++idx;
            while (idx < input.length() && (input[idx] != ',') && (input[idx] != '@')) {
                idx++;
            }
            idx--;
            if (tmp->find(input[int_begin-2]) == tmp->end()) {
                (*tmp)[input[int_begin-2]] = stoi(input.substr(int_begin, idx-int_begin+1));
            }
            idx++;
        } else if (input[idx] == '@') {
            tmp = &used_char2int_map;
            idx++;
        } else {
            idx++;
        }
    }
    // cout << all_char2int_map;
    // cout << used_char2int_map;

    // char handle
    map<char, int>::iterator it;
    for (it = used_char2int_map.begin(); it != used_char2int_map.end(); ++it) {
        all_char2int_map[it->first] -= used_char2int_map[it->first];
    }

    // output
    string& output = input;
    output.clear();
    for (it = all_char2int_map.begin(); it != all_char2int_map.end(); ++it) {
        if (it->second != 0) {
            output.push_back(it->first);
            output.push_back(':');
            output.append(to_string(it->second));
            output.push_back(',');
        }
    }
    output.pop_back();
    cout << output;
}